﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace Shop.Backend.Api.Migrations
{
    public partial class 删除商品和订单的迁移数据 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Goods",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    GoodsNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    GoodsImage = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    GoodsName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    FromShopsId = table.Column<int>(type: "int", nullable: false),
                    FromSupplierId = table.Column<int>(type: "int", nullable: false),
                    FromGoodsBrandsId = table.Column<int>(type: "int", nullable: false),
                    FromGoodsCategory1Id = table.Column<int>(type: "int", nullable: false),
                    FromGoodsCategory2Id = table.Column<int>(type: "int", nullable: false),
                    FromGoodsCategory3Id = table.Column<int>(type: "int", nullable: false),
                    Price = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    NowPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    GoodsStock = table.Column<int>(type: "int", nullable: false),
                    GoodsDesc = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    GoodsState = table.Column<int>(type: "int", nullable: false),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Goods", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "GoodsBrands",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    BrandsName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    BrandDesc = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    BrandLogo = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsBrands", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "GoodsCategory1",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CategoryName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsCategory1", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "GoodsCategory2",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    FromCategory1Id = table.Column<int>(type: "int", nullable: false),
                    CategoryName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsCategory2", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "GoodsCategory3",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    FromCategory2Id = table.Column<int>(type: "int", nullable: false),
                    CategoryName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsCategory3", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "GoodsComments",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    FromGoodsId = table.Column<int>(type: "int", nullable: false),
                    FromShopsId = table.Column<int>(type: "int", nullable: false),
                    FromUsersId = table.Column<int>(type: "int", nullable: false),
                    FromOrdersId = table.Column<int>(type: "int", nullable: false),
                    CommentContent = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsComments", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "GoodsEvaluates",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    FromGoodsId = table.Column<int>(type: "int", nullable: false),
                    FromShopsId = table.Column<int>(type: "int", nullable: false),
                    FromUsersId = table.Column<int>(type: "int", nullable: false),
                    FromOrdersId = table.Column<int>(type: "int", nullable: false),
                    scores = table.Column<int>(type: "int", nullable: false),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsEvaluates", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "GoodsExpressAddress",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    FromShopsId = table.Column<int>(type: "int", nullable: false),
                    FromUserId = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ContactPhone = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ContactAddress = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsExpressAddress", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "GoodsImages",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    FromGoodsId = table.Column<int>(type: "int", nullable: false),
                    GoodsImagesDescribe = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    GoodsImagesPath = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsImages", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "GoodsSKU",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    FromGoodsId = table.Column<int>(type: "int", nullable: false),
                    SKUName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GoodsSKU", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "LikeShops",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    FromUsersId = table.Column<int>(type: "int", nullable: false),
                    FromShopsId = table.Column<int>(type: "int", nullable: false),
                    ShopState = table.Column<int>(type: "int", nullable: false),
                    ShopAddress = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ShopPhone = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_LikeShops", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Orders",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    OrderNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    PaymentType = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsPay = table.Column<int>(type: "int", nullable: false),
                    FromUsersId = table.Column<int>(type: "int", nullable: false),
                    FromGoodsExpressAddressId = table.Column<int>(type: "int", nullable: false),
                    FromShopsId = table.Column<int>(type: "int", nullable: false),
                    FromGoodsId = table.Column<int>(type: "int", nullable: false),
                    GoodsNum = table.Column<int>(type: "int", nullable: false),
                    IsDataFlag = table.Column<int>(type: "int", nullable: false),
                    PayMoney = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Orders", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "ShoppingCarts",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    FromUsersId = table.Column<int>(type: "int", nullable: false),
                    FromShopsId = table.Column<int>(type: "int", nullable: false),
                    FromGoodsId = table.Column<int>(type: "int", nullable: false),
                    FromGoodsSKUId = table.Column<int>(type: "int", nullable: false),
                    Number = table.Column<int>(type: "int", nullable: false),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ShoppingCarts", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Shops",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ShopName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SuppliersId = table.Column<int>(type: "int", nullable: false),
                    ShopState = table.Column<int>(type: "int", nullable: false),
                    ShopAddress = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    ShopPhone = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Shops", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Suppliers",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    FromUsersId = table.Column<int>(type: "int", nullable: false),
                    SuppliersName = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SuppliersAddress = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    SuppliersPhone = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Suppliers", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Users",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Username = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    Password = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UserPicture = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UserRole = table.Column<int>(type: "int", nullable: false),
                    IsActived = table.Column<bool>(type: "bit", nullable: false),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    CreatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedTime = table.Column<DateTime>(type: "datetime2", nullable: false),
                    DisplayOrder = table.Column<int>(type: "int", nullable: false),
                    Remarks = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Users", x => x.Id);
                });

            migrationBuilder.InsertData(
                table: "GoodsBrands",
                columns: new[] { "Id", "BrandDesc", "BrandLogo", "BrandsName", "CreatedTime", "DisplayOrder", "IsActived", "IsDeleted", "Remarks", "UpdatedTime" },
                values: new object[] { 1, "这是一个全球前十的品牌", "54656654.jpg", "就爱爱", new DateTime(2021, 8, 23, 16, 31, 35, 522, DateTimeKind.Local).AddTicks(7205), 0, true, false, "种子数据", new DateTime(2021, 8, 23, 16, 31, 35, 522, DateTimeKind.Local).AddTicks(7216) });

            migrationBuilder.InsertData(
                table: "GoodsCategory1",
                columns: new[] { "Id", "CategoryName", "CreatedTime", "DisplayOrder", "IsActived", "IsDeleted", "Remarks", "UpdatedTime" },
                values: new object[] { 1, "家具", new DateTime(2021, 8, 23, 16, 31, 35, 523, DateTimeKind.Local).AddTicks(1241), 0, true, false, "种子数据", new DateTime(2021, 8, 23, 16, 31, 35, 523, DateTimeKind.Local).AddTicks(1249) });

            migrationBuilder.InsertData(
                table: "GoodsCategory2",
                columns: new[] { "Id", "CategoryName", "CreatedTime", "DisplayOrder", "FromCategory1Id", "IsActived", "IsDeleted", "Remarks", "UpdatedTime" },
                values: new object[] { 1, "客厅家具", new DateTime(2021, 8, 23, 16, 31, 35, 523, DateTimeKind.Local).AddTicks(2900), 0, 1, true, false, "种子数据", new DateTime(2021, 8, 23, 16, 31, 35, 523, DateTimeKind.Local).AddTicks(2907) });

            migrationBuilder.InsertData(
                table: "GoodsCategory3",
                columns: new[] { "Id", "CategoryName", "CreatedTime", "DisplayOrder", "FromCategory2Id", "IsActived", "IsDeleted", "Remarks", "UpdatedTime" },
                values: new object[] { 1, "沙发", new DateTime(2021, 8, 23, 16, 31, 35, 523, DateTimeKind.Local).AddTicks(5145), 0, 1, true, false, "种子数据", new DateTime(2021, 8, 23, 16, 31, 35, 523, DateTimeKind.Local).AddTicks(5153) });

            migrationBuilder.InsertData(
                table: "Shops",
                columns: new[] { "Id", "CreatedTime", "DisplayOrder", "IsActived", "IsDeleted", "Remarks", "ShopAddress", "ShopName", "ShopPhone", "ShopState", "SuppliersId", "UpdatedTime" },
                values: new object[] { 1, new DateTime(2021, 8, 23, 16, 31, 35, 522, DateTimeKind.Local).AddTicks(9873), 0, true, false, "种子数据", "就爱省就爱市就爱县就爱村10086号", "就爱商店", "188888", 0, 1, new DateTime(2021, 8, 23, 16, 31, 35, 522, DateTimeKind.Local).AddTicks(9882) });

            migrationBuilder.InsertData(
                table: "Suppliers",
                columns: new[] { "Id", "CreatedTime", "DisplayOrder", "FromUsersId", "IsActived", "IsDeleted", "Remarks", "SuppliersAddress", "SuppliersName", "SuppliersPhone", "UpdatedTime" },
                values: new object[] { 1, new DateTime(2021, 8, 23, 16, 31, 35, 522, DateTimeKind.Local).AddTicks(4651), 0, 1, true, false, "种子数据", "粉刷省粉刷市粉刷县粉刷村10007号", "就爱供应", "15647825", new DateTime(2021, 8, 23, 16, 31, 35, 522, DateTimeKind.Local).AddTicks(4680) });

            migrationBuilder.InsertData(
                table: "Users",
                columns: new[] { "Id", "CreatedTime", "DisplayOrder", "IsActived", "IsDeleted", "Password", "Remarks", "UpdatedTime", "UserPicture", "UserRole", "Username" },
                values: new object[] { 1, new DateTime(2021, 8, 23, 16, 31, 35, 518, DateTimeKind.Local).AddTicks(8253), 0, true, false, "113", "种子数据", new DateTime(2021, 8, 23, 16, 31, 35, 520, DateTimeKind.Local).AddTicks(4829), "http://localhost:8080/6.jpg", 1, "admin" });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Goods");

            migrationBuilder.DropTable(
                name: "GoodsBrands");

            migrationBuilder.DropTable(
                name: "GoodsCategory1");

            migrationBuilder.DropTable(
                name: "GoodsCategory2");

            migrationBuilder.DropTable(
                name: "GoodsCategory3");

            migrationBuilder.DropTable(
                name: "GoodsComments");

            migrationBuilder.DropTable(
                name: "GoodsEvaluates");

            migrationBuilder.DropTable(
                name: "GoodsExpressAddress");

            migrationBuilder.DropTable(
                name: "GoodsImages");

            migrationBuilder.DropTable(
                name: "GoodsSKU");

            migrationBuilder.DropTable(
                name: "LikeShops");

            migrationBuilder.DropTable(
                name: "Orders");

            migrationBuilder.DropTable(
                name: "ShoppingCarts");

            migrationBuilder.DropTable(
                name: "Shops");

            migrationBuilder.DropTable(
                name: "Suppliers");

            migrationBuilder.DropTable(
                name: "Users");
        }
    }
}
